package com.slicktechnologies.client.views.contract;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.TextBox;
import com.simplesoftwares.client.library.composite.CompositeInterface;
import com.simplesoftwares.client.library.mywidgets.ObjectListBox;
import com.slicktechnologies.client.utility.AppUtility;
import com.slicktechnologies.client.utility.Screen;
import com.slicktechnologies.shared.common.helperlayer.Config;

public class ProductComposite extends Composite implements CompositeInterface 
{

	ObjectListBox<Config> category,brand;
	TextBox tbProductName,tbmodelNo,srNo;
	Button addButton;
	
	
	
	public ProductComposite() {
		super();
		createGui();
	}

	public void createGui()
	{
		category=new ObjectListBox<Config>();
		brand=new ObjectListBox<Config>();
		AppUtility.MakeLiveConfig(category,Screen.CATEGORY);
		AppUtility.MakeLiveConfig(brand, Screen.BRAND);
		tbProductName=new TextBox();
		tbmodelNo=new TextBox();
		srNo=new TextBox();
		addButton=new Button("Add");
		initalizeWidgets();
	}
	
	public void initalizeWidgets()
	{
		Grid grid=new Grid(2,3);
		InlineLabel catLbl=new InlineLabel("Category");
		InlineLabel brandLbl=new InlineLabel("Brand");
		
		grid.setWidget(0,0,catLbl);
		grid.setWidget(1,0,category);
		
		grid.setWidget(0,0,catLbl);
		grid.setWidget(1,0,category);
		
		grid.setWidget(0,1,brandLbl);
		grid.setWidget(1,1,brand);
		
		grid.setWidget(1,2,addButton);
		initWidget(grid);
	}
	
	@Override
	public void setEnable(boolean status) {
		category.setEnabled(status);
		brand.setEnabled(status);
		addButton.setEnabled(status);
		
	}

	@Override
	public void clear() {
		category.setSelectedIndex(0);
		brand.setSelectedIndex(0);
		
	}

	@Override
	public boolean validate() {
		// TODO Auto-generated method stub
		return true;
	}

	public ObjectListBox<Config> getCategory() {
		return category;
	}

	public void setCategory(ObjectListBox<Config> category) {
		this.category = category;
	}

	public ObjectListBox<Config> getBrand() {
		return brand;
	}

	public void setBrand(ObjectListBox<Config> brand) {
		this.brand = brand;
	}

	public TextBox getTbProductName() {
		return tbProductName;
	}

	public void setTbProductName(TextBox tbProductName) {
		this.tbProductName = tbProductName;
	}

	public TextBox getTbmodelNo() {
		return tbmodelNo;
	}

	public void setTbmodelNo(TextBox tbmodelNo) {
		this.tbmodelNo = tbmodelNo;
	}

	public TextBox getSrNo() {
		return srNo;
	}

	public void setSrNo(TextBox srNo) {
		this.srNo = srNo;
	}

	public Button getAddButton() {
		return addButton;
	}

	public void setAddButton(Button addButton) {
		this.addButton = addButton;
	}
	
	

}
